]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
NetworkAgent: Handle VPN service aliases
authorDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 3 Jun 2016 16:43:42 +0000 (17:43 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 3 Jun 2016 17:27:46 +0000 (18:27 +0100)
A VPN plugin can support multiple services, indicated by an 'aliases' key.

We need to be able to spawn the appropriate auth-dialog for these aliases,
as well as the base service.

Covered as an afterthought (from comment 57) in
https://bugzilla.gnome.org/show_bug.cgi?id=658484

See also https://bugzilla.gnome.org/show_bug.cgi?id=746664 and
https://bugzilla.gnome.org/show_bug.cgi?id=767197

js/ui/components/networkAgent.js

index b5f141db4e3dd110a91ebbda400b0ef6717f0fd3..9308ac04f2eab5fdcd756a89610b0420218c2b68 100644 (file)
@@ -796,10 +796,18 @@ const NetworkAgent = new Lang.Class({
                         path = GLib.build_filenamev([Config.LIBEXECDIR, path]);
                     }
 
-                    if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE))
+                    if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE)) {
                         this._vpnBinaries[service] = { fileName: path, externalUIMode: externalUIMode, supportsHints: hints };
-                    else
+                        try {
+                            let aliases = keyfile.get_string_list('VPN Connection', 'aliases');
+
+                            for (let alias of aliases) {
+                                this._vpnBinaries[alias] = { fileName: path, externalUIMode: externalUIMode, supportsHints: hints };
+                            }
+                        } catch(e) { } // ignore errors if key does not exist
+                    } else {
                         throw new Error('VPN plugin at %s is not executable'.format(path));
+                    }
                 } catch(e) {
                     log('Error \'%s\' while processing VPN keyfile \'%s\''.
                         format(e.message, dir.get_child(name).get_path()));